﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InBU.aspx.cs" Inherits="ReportMobile.InBU" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>事业部</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link rel="Stylesheet" type="text/css" href="css/bootstrap.min.css" />
    <script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/back2top-master/back2top.js"></script>
    <link rel="Stylesheet" type ="text/css" href="js/back2top-master/back2top.css" />
    <script type="text/javascript">
        $(function () {
            Back2top.init();
            //$("table").toggle();
            $(".panel-heading").click(function (e) {
                var hid = $(this).attr("title");
                $('#' + hid).toggle();
            });
        });
    </script>
    <style type="text/css">
        .jiachu { font-weight:bold;}
        .redstrong{ font-weight:bold; color:Red;}
    </style>
</head>
<body class="container-fluid">
<%
    ReportMobile.inc.Common cm = new ReportMobile.inc.Common();
    string userAgent = Request.UserAgent;
    cm.SF_UserLog(Request.QueryString["uid"], "事业部", DateTime.Now,userAgent);
    Response.Write(cm.GetMenu(Request.QueryString["uid"], Request.QueryString["unitid"]));
    if (cm.msg.Length > 0) {
        Response.Write("<p class=\"alert-danger\">" + cm.msg + "</p>");
    }
    StringBuilder sbCYQ = new StringBuilder();
    StringBuilder sbFCY = new StringBuilder();
    string[] authCompany = ConfigurationManager.AppSettings["cyq"].ToString().Split(',');
    for (int i = 0; i < authCompany.Length; i++) {
        sbCYQ.Append(",'" + authCompany[i].Trim().Replace(" ", "") + "'");
    }
    sbCYQ.Remove(0, 1);
    authCompany = ConfigurationManager.AppSettings["fcy"].ToString().Split(',');
    for (int i = 0; i < authCompany.Length; i++) {
        sbFCY.Append(",'" + authCompany[i].Trim().Replace(" ", "") + "'");
    }
    sbFCY.Remove(0, 1);
    double dubSYB = cm.GetSumByCompany(),dubCYQ = cm.GetSumByCompany(sbCYQ),dubFCY = cm.GetSumByCompany(sbFCY);
%>
<h3 class="jiachu">合计：<span class="redstrong"><%=dubSYB %></span></h3>
<h4>川渝区：<%=dubCYQ %>，占比：<%=string.Format("{0:0.00%}",dubCYQ / dubSYB) %></h4>
<h4>非川渝：<%=dubFCY %>，占比：<%=string.Format("{0:0.00%}", dubFCY / dubSYB)%></h4>
<!--第1层循环-->
<%
    if (dt != null) {
        for (int i = 0; i < dt.Rows.Count; i++) {
            dr = dt.Rows[i];
%>
<h3 class="text_center jiachu text-center"><%=dr["品类"]%></h3>
        <div id="repDataRow" class="panel panel-primary">
            <div title="repTitle<%=i %>" class="panel-heading">
                <div class="panel-title sf_panel_title"><%=string.Format("{0:N}", dr["欠款余额"])%>（<%=string.Format("{0:0.00%}",Convert.ToDouble(dr["欠款余额"]) / dubSYB) %>）</div>
            </div>
            <!--严格按样式加头部、再加标题，效果要好很多-->
            <%
        if (dtDetail != null) {
            
            %>
            <table id="repTitle<%=i %>" class="panel-body table table-hover table-bordered">
            <%for (int k = 0; k < dtDetail.Rows.Count; k++) {
                  drDetail = dtDetail.Rows[k];  //内循环取明细
                  if (drDetail["品类"].ToString() == dr["品类"].ToString())  //与品类比较，取与外层品类相同的明细
                {
                        %>
                        <tr>
                            <%--<td width="20%"><%=dr2["公司简称"]%></td>--%>
                            <td width="40%"><%=drDetail["借款类型"]%></td>
                            <td width="40%"><%=string.Format("{0:n}", drDetail["欠款余额"])%></td>
                        </tr>
                        <%
                }
              }
        %>
            </table><!-- repTitle i -->
        </div>
<%            
        }
        }
    }
%> <!--第1层循环-->
    <p class="alert alert-success redstrong">*统计截止时间 <%=rptDate%>，单位：元</p>
</body>
</html>
